/* =============================================
Comment: 새창을 연다
Return :
Usage  :
============================================= */
function openCategoryWindow(url, winName, winWidth, winHeight, winOptions) {
	var posX=0;
	var posY=0;
	var nWidth=Number(winWidth);
	var nHeight=Number(winHeight);

	if (screen.width>nWidth) {
		posX=(screen.width-nWidth)/2;
	} else {
		nWidth=screen.width;
	}

	if (screen.height>nHeight) {
		posY=(screen.height-nHeight)/2;
	} else {
		nHeight=screen.height;
	}

	winProps="status=1, width="+nWidth+", height="+nHeight+", top="+posY+", left="+posX+", "+winOptions;
	win = window.open(url,winName,winProps);
	win.focus();
}

function openCategorySelectWindowFunc(titlepath, idpath, namepath, js_func) {
	if( titlepath == "" ) titlepath = "" ;
	if( idpath    == "" ) idpath = "" ;
	if( namepath  == "" ) namepath = "" ;
	   
	var openurl = "/bppoc/category/categorySelect.omp?titlepath=" + titlepath + "&idpath="
					+ idpath +"&namepath=" + namepath + "&leafOnly=true"
					+ "&js_func=" + js_func;
					
	openCategoryWindow( openurl, "myentitycategorysearch", '700', '450', 'marginwidth=0,marginheight=0' ) ;
}

/**
 * 표준분류 선택 팝업 - 고화질용. 컨텐트타입으로 그에 맞는 표준분류(CATEGORY_TYPE)를 표시
 * @param titlepath
 * @param idpath
 * @param namepath
 * @param js_func
 * @param categoryType
 * @return
 */
function openCategorySelectWindowFunc(titlepath, idpath, namepath, js_func, categoryType) {
	if( titlepath == "" ) titlepath = "" ;
	if( idpath    == "" ) idpath = "" ;
	if( namepath  == "" ) namepath = "" ;
	   
	var openurl = "/bppoc/category/categorySelect.omp?titlepath=" + titlepath + "&idpath="
					+ idpath +"&namepath=" + namepath + "&leafOnly=true"
					+ "&js_func=" + js_func + "&categoryType=" + categoryType;
					
	openCategoryWindow( openurl, "myentitycategorysearch", '700', '450', 'marginwidth=0,marginheight=0' ) ;
}

// 분류체계 항목 선택창을 팝업하고 사용자의 선택항목 정보를 얻어온다.
// 결과값 예 ) id="00001"        name="보드게임"      title="엔터테인먼트 >> 게임 >> 보드게임"
// @param titlepath : 카테고리의 전체경로 값을 받아올 입력태그 정보    예 ) form1.fullPathText
// @param idpath    : 카테고리 아이디 를 받아올 입력태그 정보          예 ) form1.categoryId   
// @param namepath  : 카테고리명 을 받아올 입력태그 정보              예 ) form1.categoryNameText
function openCategorySelectWindow( titlepath, idpath, namepath, categoryType ) {
	if( titlepath == "" ) titlepath = "" ;
	if( idpath    == "" ) idpath = "" ;
	if( namepath  == "" ) namepath = "" ;
	if( categoryType  == "") categoryType = "" ;
	   
	var openurl = "/bppoc/category/categorySelect.omp?titlepath=" + titlepath + "&idpath=" + idpath +"&namepath=" + namepath + "&categoryType=" + categoryType + "&leafOnly=false";
	openCategoryWindow( openurl, "mycategorysearch", '700', '450', 'marginwidth=0,marginheight=0' );
}

// 분류체계 항목 선택창을 팝업하고 사용자의 선택항목 정보를 얻어온다.
// openCategorySelectWindow 함수와 동일하고 엔트리 항목만 선택할 수 있다.
// 결과값 예 ) id="00001"        name="보드게임"      title="엔터테인먼트 >> 게임 >> 보드게임"
// @param titlepath : 카테고리의 전체경로 값을 받아올 입력태그 정보    예 ) form1.inputfield1
// @param idpath    : 카테고리 아이디 를 받아올 입력태그 정보          예 ) form1.inputfield2   
// @param namepath  : 카테고리명 을 받아올 입력태그 정보              예 ) form1.inputfield3
function openLeafCategorySelectWindow( titlepath, idpath, namepath, categoryType ) {   
	if( titlepath == "" ) titlepath = " " ;
	if( idpath    == "" ) idpath    = " " ;
	if( namepath  == "" ) namepath  = " " ;
	if( categoryType  == "") categoryType = " " ;
	
	var openurl = "/bppoc/category/categorySelect.omp?titlepath=" + titlepath + "&idpath=" + idpath +"&namepath=" + namepath + "&categoryType=" + categoryType + "&leafOnly=true" ;
	openCategoryWindow( openurl, "myentitycategorysearch", '700', '450', 'marginwidth=0,marginheight=0' ) ;
}
